package AppConfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}
type Redis struct {
	Host     string
	Port     int
	Password string
	Database int
}

type AppConfig struct {
	Mysql Mysql
	Redis Redis
}

var Config AppConfig

func Init() {
	viper.SetConfigFile("AppCongih/dev.yaml")

	err := viper.ReadInConfig()
	if err != nil {
		panic(err)
		return
	}

	err = viper.Unmarshal(&Config)
	if err != nil {
		panic(err)
		return
	}
	fmt.Println("配置成功", Config)

}
